package cn.zhpdmmz.service.impl;

import cn.zhpdmmz.entity.ReservationInformationDetail;
import cn.zhpdmmz.mapper.ReservationInformationDetailMapper;
import cn.zhpdmmz.service.IReservationInformationDetailService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (ReservationInformationDetail)表服务实现类
 *
 * @author CJW
 * @since 2022-04-23 01:29:19
 */
@Service("reservationInformationDetailService")
public class ReservationInformationDetailServiceImpl implements IReservationInformationDetailService {
    @Resource
    private ReservationInformationDetailMapper reservationInformationDetailMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param reservationInformationDetailId 主键
     * @return 实例对象
     */
    @Override
    public ReservationInformationDetail queryById(Integer reservationInformationDetailId) {
        return this.reservationInformationDetailMapper.queryById(reservationInformationDetailId);
    }

    /**
     * 查询指定行
     *
     * @param reservationInformationDetail 筛选条件
     * @return 查询结果
     */
    @Override
    public List<ReservationInformationDetail> queryAll(ReservationInformationDetail reservationInformationDetail) {
        return this.reservationInformationDetailMapper.queryAll(reservationInformationDetail);
    }

    /**
     * 新增数据
     *
     * @param reservationInformationDetail 实例对象
     * @return 实例对象
     */
    @Override
    public ReservationInformationDetail insert(ReservationInformationDetail reservationInformationDetail) {
        this.reservationInformationDetailMapper.insert(reservationInformationDetail);
        return reservationInformationDetail;
    }

    /**
     * 修改数据
     *
     * @param reservationInformationDetail 实例对象
     * @return 实例对象
     */
    @Override
    public ReservationInformationDetail update(ReservationInformationDetail reservationInformationDetail) {
        this.reservationInformationDetailMapper.update(reservationInformationDetail);
        return this.queryById(reservationInformationDetail.getReservationInformationDetailId());
    }

    /**
     * 通过主键删除数据
     *
     * @param reservationInformationDetailId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer reservationInformationDetailId) {
        return this.reservationInformationDetailMapper.deleteById(reservationInformationDetailId) > 0;
    }
}
